package com.hsd.survey.helper;

import net.sf.json.JSONObject;

import com.hsd.survey.model.HsdModelAnswer;
import com.hsd.survey.model.HsdModelQuestion;

public class SurveyDataHelper {
	/**
	 * 获取问题JSON对象
	 * @param questionJObject
	 * @param modelQuestion
	 * @return
	 */
	public static JSONObject getQuestinJObject(HsdModelQuestion modelQuestion){
		JSONObject questionJObject = new JSONObject();
		questionJObject.put("createtime", modelQuestion.getCreatetime());
		questionJObject.put("description", modelQuestion.getDescription());
		questionJObject.put("descriptionview", modelQuestion.getDescriptionview());
		questionJObject.put("fatherquestionid", modelQuestion.getFatherquestionuuid());
		questionJObject.put("format", modelQuestion.getFormat());
		questionJObject.put("id", modelQuestion.getQuestionuuid());
		questionJObject.put("imageheight", modelQuestion.getImageheight());
		questionJObject.put("imagetype", modelQuestion.getImagetype());
		questionJObject.put("imageurl", modelQuestion.getImageurl());
		questionJObject.put("imagewidth", modelQuestion.getImagewidth());
		questionJObject.put("instruction", modelQuestion.getInstruction());
		questionJObject.put("isgridchildquestion", modelQuestion.getIsgridchildquestion());
		questionJObject.put("modifytime", modelQuestion.getModifytime());
		questionJObject.put("pageid", modelQuestion.getPageuuid());
		questionJObject.put("rangeformat", modelQuestion.getRangeformat());
		questionJObject.put("rangemax", modelQuestion.getRangemax());
		questionJObject.put("rangemin", modelQuestion.getRangemin());
		questionJObject.put("required", modelQuestion.getRequired());
		questionJObject.put("showhasother", modelQuestion.getShowhasother());
		questionJObject.put("showpoint", modelQuestion.getShowpoint());
		questionJObject.put("sortindex", modelQuestion.getSortindex());
		questionJObject.put("surveyid", modelQuestion.getSurveyuuid());
		questionJObject.put("type", modelQuestion.getType());
		questionJObject.put("typeid", modelQuestion.getTypeid());
		return questionJObject;
	}
	
	/**
	 * 获取答案JSON对象
	 * @param modelAnswer
	 * @return
	 */
	public static JSONObject getAnswerJObject(HsdModelAnswer modelAnswer){
		JSONObject answerJObject = new JSONObject();
		answerJObject.put("createtime", modelAnswer.getCreatetime());
		answerJObject.put("hasother", modelAnswer.getHasother());
		answerJObject.put("id", modelAnswer.getAnsweruuid());
		answerJObject.put("imageheight", modelAnswer.getImageheight());
		answerJObject.put("imagetype", modelAnswer.getImagetype());
		answerJObject.put("imageurl", modelAnswer.getImageurl());
		answerJObject.put("imagewidth", modelAnswer.getImagewidth());
		answerJObject.put("name", modelAnswer.getName());
		answerJObject.put("point", modelAnswer.getPoint());
		answerJObject.put("questionid", modelAnswer.getQuestionuuid());
		answerJObject.put("sortindex", modelAnswer.getSortindex());
		answerJObject.put("surveyid", modelAnswer.getSurveyuuid());
		return answerJObject;
	}
}
